﻿var strRootPath = window.document.location.protocol + "//" + window.document.location.host + "/";
$(document).ready(function () {
    getMsgCount();
    setInterval("getMsgCount()", 20000);
});
function getMsgCount() {
    try {
        var time = new Date();
        var vl = $.ajax({
            url: strRootPath + "handler/getShopMsgCount.ashx?time=" + time,
            async: false
        }).responseText;
        if (!isNaN(vl)) {
            var count = parseInt(vl);
            if (count > 0) {
                $("#msgLink").removeClass("hideShopMsg");
                $("#msgLink").addClass("showShopMsg");
                $("#msgCount").html(vl);
            }
            else {
                $("#msgLink").removeClass("showShopMsg");
                $("#msgLink").addClass("hideShopMsg");
            }
        }
        else {
            $("#msgLink").removeClass("showShopMsg");
            $("#msgLink").addClass("hideShopMsg");
        }
    }
    catch (e) {
        $("#msgLink").removeClass("showShopMsg");
        $("#msgLink").addClass("hideShopMsg");
    }
}